//
//  Extension+UIImage.swift
//  WeiBo
//
//  Created by chenguanglei on 16/12/4.
//  Copyright © 2016年 itheima. All rights reserved.
//

import UIKit

extension UIImage{

    class func getScreenShot() -> UIImage{
    
        let window = UIApplication.shared.keyWindow
        
        //大小 透明 缩放(0默认大小)
        UIGraphicsBeginImageContextWithOptions(kUIScreenSize, false, 0.0)
        
        window?.drawHierarchy(in: kUIScreenBounds, afterScreenUpdates: false)
        
        let image = UIGraphicsGetImageFromCurrentImageContext()
        
        UIGraphicsEndImageContext()
        
    return image!
    }

}
